<p>This rule raises an issue when <code>Promise.resolve()</code> or <code>Promise.reject()</code> are returned or yielded in async functions, async
generators, or promise callback methods (then/catch/finally).</p>
<h2>Why is this an issue?</h2>
<p>In JavaScript, async functions and promise callback methods automatically wrap return values in promises. Using <code>Promise.resolve()</code> or
<code>Promise.reject()</code> in these contexts creates unnecessary complexity and redundancy.</p>
<p>When you return a value from an async function, it’s automatically wrapped in a resolved promise. Similarly, when you return from a
<code>.then()</code>, <code>.catch()</code>, or <code>.finally()</code> callback, the value is automatically wrapped in a promise.</p>
<p>For error handling, throwing an error is more idiomatic and clearer than returning <code>Promise.reject()</code>. The <code>throw</code> statement
clearly indicates that an error condition has occurred, while <code>return Promise.reject()</code> obscures this intent.</p>
<p>This redundancy makes code harder to read and understand, especially for developers learning async programming patterns. It also suggests a
misunderstanding of how promises and async functions work.</p>
<h3>What is the potential impact?</h3>
<p>This issue primarily affects code maintainability and readability. While it doesn’t cause runtime errors, it:</p>
<ul>
  <li> Makes code unnecessarily verbose and harder to understand </li>
  <li> Suggests confusion about async programming concepts </li>
  <li> Can mislead other developers about the actual behavior of the code </li>
  <li> Reduces consistency with modern JavaScript async/await best practices </li>
</ul>
<h3>How to fix?</h3>
<p>Remove the unnecessary Promise.resolve() wrapper and return the value directly in async functions.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
const fetchData = async () =&gt; {
  const result = await getData();
  return Promise.resolve(result); // Noncompliant
};
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="1" data-diff-type="compliant">
const fetchData = async () =&gt; {
  const result = await getData();
  return result;
};
</pre>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/sindresorhus/eslint-plugin-unicorn#readme">eslint-plugin-unicorn</a> - Rule <a
  href="https://github.com/sindresorhus/eslint-plugin-unicorn/blob/HEAD/docs/rules/no-useless-promise-resolve-reject.md">no-useless-promise-resolve-reject</a> </li>
  <li> MDN - async function - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">Comprehensive
  guide to async functions and their behavior</a> </li>
  <li> MDN - Promise.resolve() - <a
  href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve">Documentation for Promise.resolve()
  method</a> </li>
  <li> MDN - Using Promises - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises">Guide to working with promises in
  JavaScript</a> </li>
</ul>
